home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 019a / amac40.zip / SRCH29.QM < prev    next >
Text File  |  1991-08-02  |  62KB  |  1,240 lines

  1. *                            SRCH29.QM, v2.9b
  2. *             Macros To Search/Replace In Text And ZIP Files
  3. *                        Written by Tom Hogshead
  4. *                             August 2, 1991
  5. *
  6. * @(0)*  Search/Replace From Command Line:
  7. *                 -  SR.BAT
  8. *                 -  SZR.BAT, search/replace files within ZIP files
  9. * @(4)   Search/Replace From Command Line, Quit Each File After Replacement:
  10. *                 -  SRQ.BAT
  11. * @(6)   Search From Command Line:
  12. *                 -  SM.BAT  (uses MAXFIND)
  13. * @(7)*  Search From Command Line:
  14. *                 -  SRL.BAT
  15. *                 -  SZ.BAT, search files within ZIP files, no replace
  16. *         * NOTE:Same macro @7 used for SZ and SRL batch files
  17. *                Same macro @0 used for SR and SZR batch files
  18. *                    (See batch files for instructions)
  19. *         >>>>>>> (Macros @0_4_6_7 cannot be run while editing) <<<<<<<
  20. *
  21. * @(1)─┐ Makes FileList of files containing search text while editing
  22. * @(2)─┤ Loads FileList of files containing search text while editing
  23. * @(8)─┘ Search/replace while editing loaded files only, prompts,
  24. *        saves ONLY & keeps loaded ONLY files w/replacements.
  25. * @(5) - Search/replace while editing, finds/loads files, prompts
  26. * @(9) - Search ONLY loaded files, keep loaded ONLY files w/ found text
  27. * ^(f1_) Find multiple search text in current file, uses FGREP.COM
  28. * ^(f2_) Find multiple search text in current file, uses Dos FIND
  29. * ^(f3_) View another occurrence of search text in current file
  30. * (F4) - RepeatFind
  31. * (F5) - PrevFile
  32. * (F6) - NextFile
  33. * @(a)   Moves cursor to first word delimiter after wordleft
  34. * @(f)   Moves cursor to first word delimiter after wordright
  35. * ^(a_)  Moves cursor to first character of wordleft
  36. * ^(f_)  Moves cursor to first character of wordright
  37. * @(h) - Select Index item with cursor line, then <enter>                 |chg
  38. *
  39. * (CursorLeft)  Wrap cursor to previous line like Wordstar does
  40. * (CursorRight) Wrap cursor to next       "    "     "       "
  41. *       (These two macros. written by Tim Farley, are commented out)
  42. *
  43. * (Index) Use      - How to locate macro or item below from Index using @h
  44. * (Description)    - Search/Replace Macros
  45. * (Startup)        - What's required
  46. * (Environment) Variables
  47. * (Required) Program Files
  48. * (Macros)
  49. * (Other) Macros
  50. * (CAUTION) <<<<<<<<<<<<<<<<<<< IMPORTANT
  51. * (Version) history
  52. *
  53. *-- eoi
  54.  
  55.  
  56.  
  57. *                Confirms  Saves    Must Be
  58. *                Replace-  Loaded   First
  59. * Key Run While  ment?     Files?   Macro? (1)        Comments
  60. * ──  ─────────  ────────  ──────   ────── ───  ───────────────────
  61. * @6  cmnd line  srch only n/a      yes     m   s/o w/SM.BAT
  62. * @7  cmnd line  srch only n/a      yes     f   s/o w/SRL.BAT/SZ.BAT
  63. * @0  cmnd line  no        yes      yes     f   s/r w/SR.bat/SZR.BAT
  64. * @4  cmnd line  no        yes/quit yes     f   s/r w/SRQ.bat
  65. * @1─┐editing    n/a       n/a      no      f   makes FileList only
  66. * @2─┤editing    n/a       n/a      no      f   loads files only
  67. * @8─┘editing    yes       rpl only no      f   s/r loaded files
  68. * @5  editing    yes       rpl only no      f   s/r finds files
  69. * @9  editing    srch only no       no      f   s/o loaded files
  70. * ^F1 editing    srch only no       no      f   s/o current file
  71. * ^F2 editing    srch only no       no      f   s/o current file
  72. * ^F3 editing    n/a       no       no          view another occurrence
  73. * ---------------
  74. * (1) Uses  m- MAXFIND, f - FGREP.COM
  75.  
  76. * (INDEX) USE; To locate a macro or item in this file, press @h, place
  77. * the cursor line on the desired item in the Index above, and press
  78. * <enter>. See BOOKxx.QM for more details.
  79.  
  80. * (DESCRIPTION): (SRCH29) are QEdit macros to search/replace and search
  81. * only files containing search text from a file pattern or a FileList
  82. * of file patterns to search using FGREP.COM and MAXFIND. Only files
  83. * containing the search text are loaded automatically, and then the
  84. * desired search/replace is performed. Search/replace may be done from
  85. * the command line and while editing files. Search or search/replace
  86. * may be also performed on ZIP files without manually unzipping and
  87. * rezipping.
  88.  
  89. * In addition to SR, SRL, and SRQ batch files, two additional batch
  90. * files are provided to search and replace files within ZIP's. SZ.BAT
  91. * and SZR.BAT are batch files using FGREP.COM to search and
  92. * search/replace text within ZIP's without having to manually unzip,
  93. * search, replace, and then rezip. For example, at the command line:
  94.  
  95. *                  SRZ  fff  FFF  TEST        <enter>
  96.  
  97. * finds all occurrences of "fff" in files within TEST.ZIP and replaces
  98. * it with "FFF". Files containing "fff" are loaded after replacement so
  99. * each replacement can be viewed before re-zip. The user is given the
  100. * option of updating each ZIP on a file by file basis before re-zipping.
  101.  
  102. * Batch file SM.BAT is also provided to search text files with MAXFIND.
  103. * SM.QM are QEdit macros to use with SM.BAT for searching files
  104. * containing a search string using MaxFind. Files are searched, found,
  105. * and loaded for editing or viewing. The search string, file names, and
  106. * other input or search options may be specified at the command line or
  107. * entered at the option query prompt. "Fuzzy", "and/or", and "sliding
  108. * window" text searches can be done.
  109.  
  110. * (STARTUP):
  111. * To BEGIN, just type "START SRCH" <Enter>. All pertinent files will be
  112. * loaded in the "Ring" for viewing, and SRCH29.MAC is read.
  113. * Alternatively, type "START SRCH 0" <Enter> and the disk copies of all
  114. * files in the "Ring" will be loaded ready for editing, saving time.
  115.  
  116.  
  117. * To perform a search/replace from the command line, type SR, and
  118. * answer the prompts for search and replace text. To perform a SEARCH
  119. * ONLY from the command line, type SRL, and answer the prompts for
  120. * search text. All searches with these macros and batch files are
  121. * Case insensitive. To perform a case sensitive search, change "GIN"
  122. * to "GN"in the macros below and "-f" to "-fc" in the batch files.
  123.  
  124. * Search and replacement text may be single or multiple words only
  125. * when answering search and replacement query prompts, not from the
  126. * command line.
  127. *
  128. * Replacing C: with your ram disk will make the macros run faster.
  129.  
  130. * (ENVIRONMENT) VARIABLES:
  131.  
  132. * All search and search/replace batch files use environment variables.
  133. * Some environment variables can be set to facilitate use of these
  134. * batch files, however setting any environment variable is optional. If|2.9
  135. * any or all of the following environment variable are *not* set (ie   |
  136. * "SET [name]= " the user will be prompted for the required inputs, or
  137. * values can be specified at the command line as described in each
  138. * batch file.
  139.  
  140. * a) "SET OPT=off" will bypass the option query prompt in SRL.BAT and
  141. *     SM.BAT, and bypass the File Name query prompt in SR.BAT and
  142. *     SRQ.BAT.
  143.  
  144. * b) "SET OPT= " will *not* bypass the option query prompt in SRL.BAT
  145. *     and SM.BAT, and will *not* bypass the File Name query prompt in
  146. *     SR.BAT and SRQ.BAT.
  147.  
  148. * c) "SET FILELIST=srch-fg.lst" searches with standard file list
  149. *     srch-fg.lst in SR.BAT, SRL.BAT and SRQ.BAT. SM.BAT uses the
  150. *     program MAXFIND which cannot search from filelists.
  151.  
  152. * d) "SET FILELIST=c:\srch-fg.lst" searches with standard file list
  153. *     c:\srch-fg.lst in SR.BAT, SRL.BAT and SRQ.BAT.
  154.  
  155. * e) "SET FILELIST=sm.lst" searches with standard file list sm.lst
  156. *     for testing SR.BAT, SRL.BAT and SRQ.BAT. SM.LST is provided in
  157. *     AMACxx.ZIP. SM.LST is just one line "*.tst" to search SM.TST, and
  158. *     any other files with extension .tst.
  159.  
  160. * f) "SET FILELIST= " will prompt for file name(s) or an @filelist at
  161. *     the File Name query prompt. The batch files are written to use
  162. *     file list SM.LST if nothing is entered at the File Name query
  163. *     prompt.
  164.  
  165. * The macros used with these batch files must either be located in the
  166. * current directory from which we are searching, or the location of
  167. * these macros must be specified with the environment variable SRMAC as
  168. * follows:
  169.  
  170. * g) "SET SRMAC= " means macro files are located in current directory
  171. *     from which we are searching.
  172.  
  173. * h) "SET SRMAC=c:\" means macro files are located in c:\ directory.
  174. *     c:\ may be any drive:\path\ terminating with a \.
  175.  
  176. * By default, SZ.BAT and SZR.BAT create, and delete afterwards, a      |
  177. * temporary directory c:\$zip$ into which the ZIP file is un-zipped. It|
  178. * is preferable to use a ram drive for speed. An alternative temporary |
  179. * directory can be used by setting the environment variable SZTEMP as  |
  180. * follows:                                                             |
  181.                                                                        |2.9
  182. * i) "SET SZTEMP= " uses default directory c:\$zip$ for the temporary  |
  183. *     directory.                                                       |
  184.                                                                        |
  185. * j) "SET SZTEMP=e:\name" uses directory e:\name (no trailing \) for   |
  186. *     the temporary directory.                                         |
  187.  
  188.  
  189. * Here's my SRCH-FG.LST:
  190.  
  191. *         *.qm
  192. *         *.ql
  193. *         *.inf
  194. *         *.bat
  195. *         *.lst
  196. *         *.me
  197. *         *.doc
  198. *         *.syn
  199. *         e:\syn\sa.syn
  200. *         u:\sr?.bat
  201.  
  202. * The SA.SYN entry is my PCED synonym file. The batch files have more
  203. * information and instructions.
  204.  
  205. * The following temporary environment variables are set during batch
  206. * file operation and need not be set by the user:
  207.  
  208. *         S~~     search text
  209. *         R~~     replacement text
  210. *         file    File Name or file list specified at query prompt or
  211. *                 at the command line.
  212.  
  213. * All environment variables remain as set during operation so they may
  214. * be viewed with SET afterwards.
  215.  
  216. * ******* (CAUTION) ***********
  217.  
  218.   *************************************************************************
  219.   * Alt_0/4/6/7 set and use the Dos environment variables S~~ and R~~.    *
  220.   * The letters "S~~" and "R~~" must NOT occur in any other Dos           *
  221.   * environment variable name or value. If any files being searched have  *
  222.   * attribute set Read Only, macros will stop when they try to save a     *
  223.   * Read Only file after replacements have been made.                     *
  224.   *************************************************************************
  225.  
  226. * You must have enough environment space to store both the search and
  227. * replacement text. I suggest at least 100 bytes.
  228.  
  229. * QEdit must be named Q.EXE.
  230.  
  231. * Insert should be ON.
  232.  
  233. * For (other) macros, see ALLMACRO.INF.
  234.  
  235. * These macros require "QEdit and QMAC v2.1, February, 1990" or later.
  236.  
  237. * (REQUIRED) PROGRAM FILES
  238. *
  239. * You──MUST──have the executable program files in AMAC-PRG.ZIP to run
  240. * some of these macros. AMAC-PRG.ZIP can be found on the following BBS's:
  241. *
  242. *                                 SemWare
  243. *                                 Exec-PC
  244. *
  245. * It can NOT be found on CompuServe since many of the programs are
  246. * Copyrighted. All program files are ShareWare, and inclusion in
  247. * AMAC-PRG.ZIP is not prohibited in their documentation.
  248. *
  249. * FGREP.COM.ZIP and INPUT.ZIP are the only files necessary to run SR.BAT,
  250. * SRL.BAT and SRQ.BAT. MAXFND23.COM and INPUT.COM are the only files
  251. * necessary to run SM.BAT. FGREP.COM, DX.EXE,  PKZIP.EXE and PKUNZIP.EXE
  252. * are required to run SZ.BAT and SZR.BAT.
  253. *
  254. * FGREP.COM can be found on Exec-PC as FGREP172.ZIP. INPUT can be found on
  255. * Exec-PC as INPUT.ZIP. I understand FGREP.COM v2.00 is released but as of
  256. * April 25, 1991  I have not been able to locate it on EXec-PC or
  257. * CompuServe. MAXFIND v2.3 can be found on CompuServe IBMSYS Lib 3 as
  258. * MAXFND.ZIP and on EXec-PC as MAXFND23.ZIP
  259.  
  260. * See SR.BAT and SZR.BAT for files required to search/replace within
  261. * Zip's.
  262.  
  263. *
  264. * AMAC-PRG.ZIP contains:
  265. * ----------------------
  266. * Name          Length    Method     SF   Size now  Mod Date
  267. * ============  ========  ========  ====  ========  =========
  268. * INPUT.ZIP         3097   Stored     0       3097  07 May 86
  269. * MAXFND23.ZIP     24247   Stored     0      24247  26 Apr 90
  270. * RJ.ZIP            9965   Stored     0       9965  01 Dec 90
  271. * FGREP172.ZIP     12513   Stored     0      12513  19 May 90
  272. * DX211.ZIP       100895   Stored     0     100895  17 Mar 89
  273. * AMAC-PRG.INF      3138  Imploded   67       1014  23 Apr 91
  274. * ============  ========  ========  ====  ========  =========
  275. * *total     6    153855  ZIP 1.10    0%    152329  23 Apr 91
  276. *
  277. * These files are probably on many other BBS's also.
  278. *
  279. * I thank the authors for these excellent programs.
  280.  
  281. * (Macros):--------------------------------------------------------
  282.  
  283. * 
  284. *┌─────────────────────────────────────────────────────────────────────┐
  285. *│ @(0) Macro for search/replace from command line with SR.BAT         │
  286. *└─────────────────────────────────────────────────────────────────────┘
  287. *  ******** MUST BE FIRST MACRO IN FILE FOR START UP IN SR.BAT*********
  288. *            ****** MUST RUN SR.BAT TO USE THIS MACRO******
  289. *
  290. * To do a search/replace from command line, just type SR, and answer
  291. * prompts for search and replacement text.
  292. *
  293. * SRCH.TST is included to show how this macro works. Type/enter at the
  294. * command line as follows:
  295. *
  296. *  1.   "SR"  <enter>
  297. *  2.   "aaa" space "bbb" <enter>   (answer SEARCH text prompt)
  298. *  3.   "aaa" space "BBB" <enter>   (answer REPLACEMENT text prompt)
  299. *  4.    SRCH.TST <enter>           (answer FileList prompt)
  300.  
  301. * See SR.BAT to enter parameters at command line.
  302.  
  303. * This version of @0 also uses the "Once-Around the ring" technique of
  304. * Kyle Watkins. This macro is smaller and faster than Version 1.8 and
  305. * prior because files are loaded by NextFile rather than EditFile, and
  306. * SET >c:\$ is moved to the SR.BAT batch file from the macro.
  307.  
  308. * When finished running with the batch file or PCED, the following
  309. * files are loaded for viewing or editing:
  310. *
  311. * Window 1   c:\!  List of files found & search text (output from FGREP.COM)
  312. * Window 2...n+1 = Files containing search text, n = # files with search text)
  313. *
  314. * IT CANNOT BE RUN WHILE EDITING!
  315. *
  316. * Temporary file names are:
  317. *
  318. * NUL      NUL file
  319. * c:\$.ql  List of files found & search text (output from FGREP.COM)
  320. * c:\!     Same as c:\$.ql
  321. * c:\$     Output of Dos SET.
  322.  
  323. *
  324. @0      MacroBegin
  325.         altwordset                      * For all file names
  326. * ------------------ display "No found text" message -----------------*
  327.         cursordown cursorup             * Test if any search text found
  328.         jtrue START:                    * If found, move on
  329.  MESSAGE:                               *
  330.         "No found text "                * If not found, display this
  331.         jump END:                       * End macro if no found text
  332.  START:                                 *
  333. * ---------------------------- load files ----------------------------*
  334.         endfile                         * Get to end of file
  335.  LOADAGAIN:                             *
  336.         unmarkblock                     * Unmark last file name
  337.         find #42 "Fi" return "B"  return* Find file name
  338.  jfalse  MESSAGE:                       * No find ?, show message, end
  339.         wordright                       * Move to space
  340.         wordright                       * Move to file name
  341.         markcolumn                      * Mark it
  342.         endline                         * Get all name in block
  343.         copy                            * Copy file name to scrap
  344.         EditFile                        * Get ready to load
  345.         CurrentFilename " "             * To force return *here*
  346.         Paste Return                    * Paste file name & do it!
  347.         cursorup                        * Go to next line
  348.  jfalse ENDLOAD:                        * No more filenames? Done load
  349.  jump LOADAGAIN:                        * Check again
  350.  ENDLOAD:                               *
  351.         quit                            * Quit c:\! from ring so no rplc
  352. * -------------------- get search text to scratch --------------------*
  353.         editfile "c:\$" return          * Load set output file
  354.         find  "S~~" return return       * Find S~~                     |27
  355.         find "=" return return          * Move to =                    |
  356.         cursorright                     * Move first character         |
  357.         markcharacter                   * Mark it                      |
  358.         endline                         * Move to end of text          |
  359.         storescrbuff "S~~" return       * Store SEARCH text to scratch |
  360. * ------------------- get replace text to scratch -------------------*
  361.         unmarkblock                     * Get ready
  362.         begfile                         * Get to top
  363.         find  "R~~" return return       * Find R~~                     |2.7
  364.         find "=" return return          * Move to =                    |
  365.         cursorright                     * Move first character         |
  366.         markcharacter                   * Mark it                      |
  367.         endline                         * Move to end of text          |
  368.         storescrbuff "R~~" return       * Store REPLACE text to scratch|
  369.         killfile                        * Kill c:\$ for next time
  370.         quit                            * Remove c:\$ from ring
  371. * --------------- get search/replace text from scratch ---------------*
  372.         Editfile "NUL" Return           * Insert -or- GoTo NUL File
  373.         getscrbuff "S~~" return cut     * Cut search text from scratch |2.7
  374.         Find paste Return escape        * Initialize find prompt
  375.         getscrbuff "R~~" return cut     * Cut replace text from scratch|2.7
  376.         FindReplace return              * Begin replacement
  377.         paste return                    * paste REPLACEMENT text
  378.        "GIN"                            * Replace options
  379. *       pause                          ** Add this to pause for options
  380.         return                          *   MUST include "GIN"
  381. * ------------------ load files, do search/replace ------------------*
  382.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  383.         LOOP:                    * Main test loop
  384.             Nextfile             * Move to next files in Ring
  385.             Cursorleft           * Move cursor left (need for NUL test)
  386.             Jfalse DOIT:         * If couldn't move to left, it's not
  387.                                  * the NUL File AND cursor position
  388.                                  * has not changed -- GO with the
  389.                                  * FindReplace
  390.                                  *ELSE
  391.                                  * Check to see if in the NUL File
  392.             Cursorleft           * Move cursor left for NUL Test
  393.             Jfalse ENDLOOP:      * If couldn't move left -- We
  394.                                  * ARE in the NUL File and Need
  395.                                  * to ENDLOOP
  396.                                  *ELSE
  397.             Cursorright          * Move back to Col. 2 in NUL File
  398.         DOIT:                    * FindReplace Loop
  399.             BegFile              * Move up in case cursor is below find
  400.             Repeatfind           * Do the FindReplace
  401.             Jtrue SAVE:          * If CHANGES are made -- SAVE the File
  402.             Quit                 * If NO CHANGES are made -- QUIT the
  403.                                  *  File
  404.             Jump LOOP:           * Return to the Main Loop
  405.         SAVE:                    * Routine to Save a File with Changes
  406.             Savefile             * Save the file
  407.             Jump LOOP:           * Return to Main Loop
  408.         ENDLOOP:                 * Loop is DONE
  409. * -------------------- initialize find for search --------------------*
  410.         getscrbuff "R~~" return  * Get replacement text from scratch   |2.7
  411.         cut                      * Cut replace text from scratch
  412.         Find paste return escape * Initialize Find
  413.         Quit                     * Quit the NUL File
  414.  END:                            *
  415. * ------------------------------ reset ------------------------------*
  416.         EditFile "c:\!" Return   * Load FGREP.COM output as first file
  417.         defaultwordset           * Set default
  418. *
  419. * 153 bytes Tue  10-02-1990  18:50:33
  420. * 223 bytes Thu  04-25-1991  11:57:13 added find initialize for search
  421. *                                     added "GIN" replace option
  422. *                                     added "No found text" message
  423. *                                     changed file "_" to "NUL", faster
  424. *                                     load FGREP.COM output as first file
  425. *                                       after replacement
  426. * 231 bytes Tue  04-30-1991  22:12:13 changed search and replace to scrap
  427.  
  428. * 
  429. *┌─────────────────────────────────────────────────────────┐
  430. *│ @(1) - makes FileList of files containing search text   │
  431. *└─────────────────────────────────────────────────────────┘
  432. @1      MacroBegin
  433.         Dos 'FGREP -f0 /'               * Make FileList                 |2.9
  434.         Pause                           *
  435.         '/>c:! @SRCH-FG.lst'            *
  436.         return return                   *
  437.         editfile "c:!" return quit      * Edit FileList
  438.         editfile return                 *
  439.         begfile                         *
  440.         MarkColumn                      * Mark begfile c:!
  441.         endfile begline                 * Mark endfile col 1
  442.         wordright wordright             * Get to file name
  443.         cursorleft                      * Move off file name
  444.         DeleteBlock                     * Delete file name
  445.         SaveFile                        * Save FileList
  446.         begfile                         * Get to begin
  447.         MarkColumn                      * Mark begfile c:!
  448.         EndFile                         * Get to end
  449.         gotocolumn "12" return          * Get all file names in block
  450.         Sort                            * Sort FileList
  451.         killfile                        * Kill c:!
  452.         begfile                         * See FileList
  453.         unmarkblock                     * Without block mark
  454. *
  455. * 99 bytes Tue  07-02-1991  17:56:32 (TH @1)
  456.  
  457. * 
  458. *┌──────────────────────────────────────────────────────────────┐
  459. *│ @(2) - loads FileList of files containing search text        │
  460. *└──────────────────────────────────────────────────────────────┘
  461. * Written by Kyle Watkins, SemWare.
  462. *
  463. @2      MacroBegin
  464. ***************************************** LOAD FileList (from QLSTxx)
  465.         EndFile BegLine                 * Start at last line
  466.  REPEAT:
  467.         UnmarkBlock MarkLine Copy       * Grab this name
  468.         EditFile                        * Get ready to load
  469.         CurrentFilename " "             * To force return *here*
  470.         Paste Return                    * Paste file name & do it!
  471.         CursorUp                        * More lines above?
  472.         JTrue REPEAT:                   * If yes, repeat.
  473. *
  474. * 19 bytes Mon  09-03-1990  00:56:04
  475.  
  476. * 
  477. * --------------------------------------------------------------------
  478. * @(4) Search/replace from command line, quit each file after rplcmnt.
  479. * --------------------------------------------------------------------
  480. *
  481. * Often the total size of files needing a "replacement" will exceed the
  482. * available memory when using SR.BAT and the startup macro @0. Macro @4
  483. * in SRQ.QM is simply a modification of @0 by replacing savefile with
  484. * file, so each file is quit after replacement. See SRQ.QM for this
  485. * macro.
  486. *
  487. * This macro must be the first macro in the file because it is used as
  488. * the startup macro with SRQ.BAT. IT CANNOT BE RUN WHILE EDITING!
  489.  
  490. * See SRQ.QM for @4.
  491.  
  492. * 
  493. *┌───────────────────────────────────────────────────────────────────┐
  494. *│ @(5) Makes and loads FileList of files containing search text,    │
  495. *│      then search/replace loaded files while editing               │
  496. *└───────────────────────────────────────────────────────────────────┘
  497. *
  498. @5     MacroBegin
  499. ***************************************** GET SEARCH TEXT
  500.         unmarkblock                     *
  501.         Editfile '!' Return             * Insert -or- GoTo NUL File
  502.        "Search Text=" markcolumn pause  * Search text?
  503.         storescrbuff "1" return copy    * Copy search text to scrap
  504. ***************************************** GET REPLACE TEXT
  505.         RETURN                          * Move to next line
  506.        "Replace Text=" markcolumn pause * Replacement text?
  507.         storescrbuff "2" return         * Store replacement to scratch
  508.         quit                            * Quit NUL
  509. ***************************************** MAKE FileList
  510.         DOS 'FGREP -f0 /'               * Make FileList                 |2.9
  511.         paste                           * Paste search text
  512.         '/>c:! @SRCH-FG.lst'            *
  513.         return return                   *
  514.         editfile "c:!" return quit      * Edit FileList
  515.         editfile return                 *
  516.         begfile MarkColumn              * Mark begfile c:!
  517.         endfile begline                 * Mark endfile col 1
  518.  jfalse END:                            * End if no search text found
  519.         wordright wordright             * Get to file name
  520.         cursorleft                      * Move off file name
  521.         DeleteBlock                     * Delete file name
  522.         begfile                         * Get to begin
  523.         MarkColumn                      * Mark begfile c:!
  524.         EndFile                         * Get to end
  525.         gotocolumn "12" return          * Get all file names in block
  526.         Sort                            * Sort FileList
  527. ***************************************** LOAD FileList (from QLSTxx)
  528.         EndFile BegLine                 * Start at last line
  529.  REPEAT:
  530.         UnmarkBlock MarkLine Copy       * Grab this name
  531.         EditFile                        * Get ready to load
  532.         CurrentFilename " "             * To force return *here*
  533.         Paste Return                    * Paste file name & do it!
  534.         CursorUp                        * More lines above?
  535.         JTrue REPEAT:                   * Yes ? repeat
  536.         killfile                        * Kill c:!
  537.         quit                            * Quit c:!
  538.         Editfile '!' Return             * Insert -or- GoTo NUL File
  539.         getscrbuff "1" return cut       * Cut search text from scratch
  540.         Find paste Return escape        * Initialize find prompt
  541.         getscrbuff "2" return cut       * Cut replace text from scratch
  542.         FindReplace return              * Begin replacement
  543.         paste RETURN                    * paste REPLACEMENT text
  544. **         "GIN" Return                    ** Replace, no prompt
  545.         Pause Return                    * Allow user input of Options
  546.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  547.         LOOP:                    * Main test loop
  548.             Nextfile             * Move to next files in Ring
  549.             Cursorleft           * Move cursor left (need for NUL test)
  550.             Jfalse DOIT:         * If couldn't move to left, it's not
  551.                                  * the NUL File AND cursor position
  552.                                  * has not changed -- GO with the
  553.                                  * FindReplace
  554.                                  *ELSE
  555.                                  * Check to see if in the NUL File
  556.             Cursorleft           * Move cursor left for NUL Test
  557.             Jfalse END:          * If couldn't move left -- We
  558.                                  * ARE in the NUL File and Need
  559.                                  * to END the Macro
  560.                                  *ELSE
  561.             Cursorright          * Move back to Col. 2 in NUL File
  562.         DOIT:                    * FindReplace Loop
  563.             BegFile              * In case cursor is below find
  564.             Repeatfind           * Do the FindReplace
  565.             Jtrue SAVE:          * If CHANGES are made, SAVE the File
  566.             Quit                 * If NO CHANGES are made, QUIT the File
  567.             Jump LOOP:           * Return to the Main Loop
  568.         SAVE:                    * Routine to Save a File with Changes
  569.             Savefile             * Save the file
  570.             Jump LOOP:           * Return to Main Loop
  571.         END:                     * Macro is DONE
  572.             Quit                 * Quit the NUL File
  573. *
  574. * 235 bytes Tue  07-02-1991  17:56:57 (TH @5)
  575.  
  576. * 
  577. * ----------------------------------------------------------------------
  578. * @(6) - Srch ONLY from command line, loads files w/sm.bat, no replace
  579. * -------------------- uses MaxFind mf.exe -----------------------------
  580. *
  581. * Files containing a search string from a file pattern are searched,
  582. * found, and loaded for editing or viewing. The search string, file
  583. * pattern, and other input or search options may be specified at the
  584. * command line or entered at the option query prompt. "Fuzzy", "and/or",
  585. * and "sliding window" text searches can be done. Text search program
  586. * is MaxFind.
  587. *
  588. * To run, type "sm" <enter>, and answer the prompts. Press F4 to
  589. * view the search string in each file after finding. Alternatively,
  590. * parameters may be specified at the command line.
  591.  
  592. * See SM.QM for @6.
  593.  
  594. * 
  595. * ┌──────────────────────────────────────────────────────────────────┐
  596. * │ @(7) -Start up macro, loads only found files, no replacement     │
  597. * └──────────────────────────────────────────────────────────────────┘
  598.  
  599. * See SRL.QM for @7.
  600.  
  601. * 
  602. * ------------------------------------------------------------------------
  603. * @(8)  MACRO TO EXECUTE THE FindReplace ACROSS THE ENTIRE RING OF FILES
  604. *     ----------------------------------------------------------------
  605. *
  606. * See Kyle Watkin's alternate version below for more discussion.
  607.  
  608. @8      Macrobegin
  609.         Editfile '!' Return      * Insert -or- GoTo NUL File
  610.         Findreplace Pause Return * Allow user input of Find Item
  611.         Pause Return             * Allow user input of Replace Item
  612.         Pause Return             * Allow user input of Options
  613.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  614.         LOOP:                    * Main test loop
  615.             Nextfile             * Move to next files in Ring
  616.             Cursorleft           * Move cursor left (need for NUL test)
  617.             Jfalse DOIT:         * If couldn't move to left, it's not
  618.                                  * the NUL File AND cursor position
  619.                                  * has not changed -- GO with the
  620.                                  * FindReplace
  621.                                  *ELSE
  622.                                  * Check to see if in the NUL File
  623.             Cursorleft           * Move cursor left for NUL Test
  624.             Jfalse END:          * If couldn't move left -- We
  625.                                  * ARE in the NUL File and Need
  626.                                  * to END the Macro
  627.                                  *ELSE
  628.             Cursorright          * Move back to Col. 2 in NUL File
  629.         DOIT:                    * FindReplace Loop
  630.             Begfile              * Needed in case cursor is below Find
  631.             Repeatfind           * Do the FindReplace
  632.             Jtrue SAVE:          * If CHANGES are made -- SAVE the File
  633.             Quit                 * If NO CHANGES made  -- QUIT the File
  634.             Jump LOOP:           * Return to the Main Loop
  635.         SAVE:                    * Routine to Save a File with Changes
  636.             Savefile             * Save the file with CHANGES
  637.             Jump LOOP:           * Return to Main Loop
  638.         END:                     * Macro is DONE
  639.             Quit                 * Quit the NUL File
  640. *
  641. * 62 bytes Sat  09-15-1990  11:17:57 (K. Watkins version)
  642. * 41 bytes Sun  09-30-1990  20:32:55 (this version)
  643.  
  644. * * ┌────────────────────────────────────────────────────────────────────┐
  645. * * │@(8)  MACRO TO EXECUTE THE FindReplace ACROSS ENTIRE RING OF FILES  │
  646. * * └────────────────────────────────────────────────────────────────────┘
  647. * *
  648. * * The following macro was written by Kyle Watkins of SemWare in
  649. * * response to my request for a macro to search/replace all loaded
  650. * * files, but also:
  651. * *         - save to disk only those files that had a replacement, and
  652. * *         - keep loaded  only those files that had a replacement made.
  653. * * It is an excellent and creative macro which I urge you to study
  654. * * because of the unique and powerful use of a NUL file as a
  655. * * place-marker.
  656. *
  657. * * ==========================================================================
  658. * * Date: 09-14-90 (11:49)           Number: 9940         SemWare Support BBS
  659. * *   To: TOM HOGSHEAD               Refer#: NONE
  660. * * From: KYLE WATKINS                 Read: NO
  661. * * Subj: ONCE AROUND THE FILE-RING    Conf: (0) Main Board
  662. * * ------------------------------------------------------------------------
  663. * * TH>I have been trying for several months to either modify the following
  664. * * TH>macro or come up with another way to search & replace all loaded
  665. * * TH>files but also to:
  666. * * TH>
  667. * * TH>        - save to disk only those files that had a replacement, and
  668. * * TH>        - keep loaded  only those files that had a replacement made.
  669. * *
  670. * * Hi Tom,
  671. * *     You may need to adjust this macro at the point where I quit the file
  672. * * if no replacements were made to it (The macro can be adjusted to save
  673. * * those files, if there were some pre-existing changes that were present
  674. * * before the macro was envolked). I wasn't sure what you wanted (my own
  675. * * preference is to retain other changes that I made before I envolked this
  676. * * macro -- BUT I wrote the macro to just Quit those files, since that is
  677. * * what I am guessing you want).
  678. * *     Basically, the macro will use the NUL file as a placeholder in the
  679. * * Ring-of-Files. With cursor manipulation, I will determine when you
  680. * * arrive at the NUL file again. Once you get back to the NUL file, the
  681. * * macro will end. Your starting point for the FindReplace throughout the
  682. * * entire Ring will be at the file immediately after the NUL file -- So if
  683. * * you do not have a NUL file already loaded, the starting point will be at
  684. * * the next file from the one that you are currently in. Otherwise, the
  685. * * starting point will be at the next file from the present location of the
  686. * * NUL file.
  687. * *     Note that I always return to the original cursor position, before
  688. * * the FindReplace is executed (allowing you to select any Option for the
  689. * * FindReplace routine).
  690. * *
  691. *
  692. * * ------------------------------------------------------------------------
  693. * *     MACRO TO EXECUTE THE FindReplace ACROSS THE ENTIRE RING OF FILES
  694. * *     ----------------------------------------------------------------
  695. * *
  696. * @8      Macrobegin
  697. *         Editfile 'NUL' Return    * Insert -or- GoTo NUL File
  698. *         Findreplace Pause Return * Allow user input of Find Item
  699. *         Pause Return             * Allow user input of Replace Item
  700. *         Pause Return             * Allow user input of Options
  701. *         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  702. *                                  *
  703. *         LOOP:                    * Main test loop
  704. *                                  *
  705. *             Nextfile             * Move to next files in Ring
  706. *             Cursorleft           * Move cursor left (need for NUL test)
  707. *             Jfalse DOIT:         * If couldn't move to left, it's not
  708. *                                  * the NUL File AND cursor position
  709. *                                  * has not changed -- GO with the
  710. *                                  * FindReplace
  711. *                                  *
  712. *                                  *ELSE
  713. *                                  * Check to see if in the NUL File
  714. *                                  *
  715. *             Editfile
  716. *             'NUL ' Currentfilename Return * GoTo NUL File -- AND--
  717. *                                           * Preload File to Edit
  718. *                                           * Buffer so can Return
  719. *                                           * to Current File
  720. *                                  *
  721. *             Cursorleft           * Move cursor left for NUL Test
  722. *             Jfalse END:          * If couldn't move left -- We
  723. *                                  * ARE in the NUL File and Need
  724. *                                  * to END the Macro
  725. *                                  *
  726. *                                  *ELSE
  727. *             Cursorright          * Move back to Col. 2 in NUL File
  728. *                                  *
  729. *             Editfile
  730. *             Begline Delch Delch Delch Return  * Bring up EditFile Prompt
  731. *                                               * and delete NUL and
  732. *                                               * Return to File we left
  733. *                                  *
  734. *             Cursorright          * Restore Cursor to its previous
  735. *                                  * position and GO with the FindReplace
  736. *                                  *
  737. *         DOIT:                    * FindReplace Loop
  738. *                                  *
  739. *             Repeatfind           * Do the FindReplace
  740. *             Jtrue SAVE:          * If CHANGES are made -- SAVE the File
  741. *                                  *
  742. *             Quit                 * If NO CHANGES are made -- QUIT the
  743. *                                  * File
  744. *                                  *
  745. *             Jump LOOP:           * Return to the Main Loop
  746. *                                  *
  747. *                                  *
  748. *         SAVE:                    * Routine to Save a File with Changes
  749. *                                  *
  750. *             Savefile             * Save the file
  751. *             Jump LOOP:           * Return to Main Loop
  752. *                                  *
  753. *         END:                     * Macro is DONE
  754. *                                  *
  755. *             Quit                 * Quit the NUL File
  756. * *
  757. * * 62 bytes Sat  09-15-1990  11:17:57 (added TH)
  758. *
  759. *
  760. * *      ----------------------------------------------------------------
  761. * *     I hope this is what you need Tom. Feel free to optimize and alter
  762. * * the macro. The main Body of this macro can be used to allow any kind of
  763. * * ONE-TIME File Ring Sweep. I have already used the main body of the macro
  764. * * (with the necessary adjustments) to Load all files that DO NOT cause a
  765. * * PRESS ESCAPE message -- So I hope it proves useful to you.
  766. * *
  767. * *                              --... ...--
  768. * * .......Kyle Watkins (SemWare Technical Support)
  769.  
  770. * 
  771. * ┌────────────────────────────────────────────────────────┐
  772. * │@(9) Keep loaded only files with "found" text.          │
  773. * └────────────────────────────────────────────────────────┘
  774. *
  775. * This macro uses the same technique developed by Kyle Watkins in @8,
  776. * to keep loaded ONLY files with "found" text. No replacement or save
  777. * is made (@8 makes replacement and saves files with replacements, but
  778. * files without any replacement are QUIT from ring).
  779. *
  780. * Version 1.6 of this macro used RepeatFind in the DOIT loop. If that
  781. * version was executed more than once and the cursor was on the last
  782. * occurrence of the search text in a file, RepeatFind would NOT find the
  783. * search text again, and the file was QUIT from the ring. Apparently
  784. * RepeatFind does NOT remember the "G" option with Find.
  785. *
  786. * This version replaces RepeatFind with Find "G". Now, if @9 is executed
  787. * more than once, any file with any occurrence of the search text is
  788. * correctly kept loaded.
  789. *
  790. @9      Macrobegin
  791.         Editfile '!' Return      * Insert -or- GoTo NUL File
  792.         Find Pause Return "G"    * Allow user input of Find Item
  793.         Pause Return             * Allow user input of Options
  794.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  795.         LOOP:                    * Main test loop
  796.             Nextfile             * Move to next files in Ring
  797.             Cursorleft           * Move cursor left (need for NUL test)
  798.             Jfalse DOIT:         * If couldn't move to left, it's not
  799.                                  * the NUL File AND cursor position
  800.                                  * has not changed -- GO with the
  801.                                  * FindReplace
  802.                                  *ELSE
  803.                                  * Check to see if in the NUL File
  804.             Cursorleft           * Move cursor left for NUL Test
  805.             Jfalse END:          * If couldn't move left -- We
  806.                                  * ARE in the NUL File and Need
  807.                                  * to END the Macro
  808.                                  *ELSE
  809.             Cursorright          * Move back to Col. 2 in NUL File
  810.         DOIT:                    * Find Loop
  811.             Find Return "G" return * Do the Find
  812.             Jtrue LOOP:          * If FOUND   -- Return to Main Loop
  813.             Quit                 * If NO FIND -- QUIT the file
  814.             Jump LOOP:           * Return to the Main Loop
  815.         END:                     * Macro is DONE
  816.             Quit                 * Quit the NUL File
  817. *
  818. * 40 bytes Sun  09-30-1990  22:48:24
  819.  
  820. * ^f1 and ^f2 macros are modifications to macros written by Tim Farley
  821. * in BIGFIND.QM dated 8/21/89 and revised 9/6/89.
  822. * 
  823. *------------------------------------------------------------
  824. * ^(f1_) Find multiple search text in current file, uses FGREP.COM
  825. *------------------------------------------------------------
  826. *
  827. * Find all instances of a given string in current file, let the user
  828. * select one, hit return, and view line containing search string.
  829. * Change "c:" to ramdrive for faster operation.
  830. *
  831. * Uses Chris Dunford's excellent FGREP.COM. Remember search string is
  832. * NOT case sensitive.
  833. *
  834. ^f1     MacroBegin                      *
  835.         UnmarkBlock DropAnchor          * Mark current file to return to
  836.                                         * later
  837.         EditFile "c:!" Return Quit      * Quit temp file if loaded
  838.                                         * Sets EditFile prompt for later
  839.         GotoBlockBeg                    * Return to where we were
  840.         UnmarkBlock                     * Unmark
  841.         DOS 'FGREP -L /'                * Prompt for search text        |2.9
  842.         Pause                           *
  843.         '/>c:! '                        * Echo output to temp file
  844.         CurrentFilename Return Return   * Search current file
  845.         EditFile Return                 * Load temp file with found text
  846.         Pause                           * Pause to select line to view
  847.         BegLine WordRight MarkWord      * Mark found text line number
  848.         Copy                            * Copy line number to scrap
  849.         KillFile                        * Delete temp file from disk
  850.         PrevFile                        * Return to searched file
  851.         GotoLine Paste Return           * View found text line
  852.         MakeCtrOfScreen                 * Put on screen center
  853. *
  854. * 67 bytes Tue  07-02-1991  17:57:22 (TH ^f1)
  855.  
  856. * 
  857. *---------------------------------------------------------------
  858. * ^(f2_) Find multiple search text in current file, uses Dos FIND
  859. *---------------------------------------------------------------
  860. *
  861. * Find all instances of a given string in current file, let the user
  862. * select one, hit return, and view line containing search string.
  863. * Change "c:" to ramdrive for faster operation.
  864. *
  865. * Uses Dos FIND. Remember search string is case sensitive.
  866. *
  867. ^f2     MacroBegin                      *
  868.         UnmarkBlock DropAnchor          * Mark current file to return to
  869.                                         * later
  870.         EditFile "c:!" Return Quit      * Quit temp file if loaded
  871.                                         * Sets EditFile prompt for later
  872.         GotoBlockBeg                    * Return to where we were
  873.         UnmarkBlock                     * Unmark
  874.         Dos 'FIND /N "'                 * Prompt for search text
  875.         Pause '" '                      *
  876.         CurrentFilename                 * Search current file
  877.         '>c:!' Return Return            * Echo output to temp file
  878.         EditFile Return                 * Load temp file with found text
  879.         Pause                           * Pause to select line to view
  880.         BegLine WordRight MarkWord      * Mark found text line number
  881.         Copy                            * Copy line number to scrap
  882.         KillFile                        * Delete temp file from disk
  883.         PrevFile                        * Return to searched file
  884.         GotoLine Paste Return           * View found text line
  885.         MakeCtrOfScreen                 * Put on screen center
  886. *
  887. * 65 bytes Sat  02-16-1991  02:55:59
  888.  
  889. * 
  890. *-------------------------------------------------------------
  891. * ^(f3_) View another occurrence of search text in current file
  892. *-------------------------------------------------------------
  893. * Position cursor on line to view another occurrence of search text in
  894. * current file, and hit <enter>. Works only after running either
  895. * ^f1 or ^f2.
  896. *
  897. ^f3 MacroBegin                          *
  898.     onewindow                           * Close all windows
  899.     horizontalwindow zoomwindow         * Open window full, current file
  900.     editfile "c:!" return               * Load temp file with found text
  901.     begline                             * Re-position cursor
  902.     pause                               * Pause to select line to view
  903.     wordright markword copy             * Mark line #, copy to scrap
  904.     zoomwindow                          * Zoom temp file window small
  905.     prevwindow                          * Back to orig file window
  906.     begline                             * Re-position cursor
  907.     gotoline paste return               * Goto found text line
  908. *   pause                               * Pause to see temp file
  909.     zoomwindow                          * Zoom orig window full
  910. *
  911. * 27 bytes Mon  02-18-1991  00:31:32
  912.  
  913. * 
  914. *┌───────────────────────────────────────────────────────────────────┐
  915. *│@(h) Finds first word on cursor line marked in document below      │
  916. *└───────────────────────────────────────────────────────────────────┘
  917. *
  918. *        @h macro has 2 steps:
  919. *
  920. *        1. Press @ and h at the same time. An ! shows at the
  921. *        end of the top line. Cursor down to desired line in Index.
  922. *
  923. *        2. Press Enter. The macro first erases the !, and
  924. *        then finds the first word on the cursor line in the document
  925. *        below marked with (...).
  926. *
  927. * See BOOKxx.QM for more details.
  928. *
  929. @h macrobegin
  930.         unmarkblock                     * Unmark any marked blocks
  931.         defaultwordset                  * In case altwordset on
  932.         begfile                         *
  933.         endpara                         * Move to end of Index
  934.         markline                        * Mark it
  935.         begfile                         * Move to bof
  936.         find "(" return "L" return      * Locate first Index selection line
  937.     jfalse NOMARK:                      *
  938.         makectrofscreen                 * Show top of file
  939.         begfile                         * Move back to bof
  940.         unmarkblock markline markline   * And highlight line 1
  941.         prevposition                    * Move back to first selection line
  942.         begline                         * Cursor in col 1
  943.         pause                           * Pause for Index selection
  944.         wordright markword              * Mark first word on line
  945.         copy                            * Copy word to scrap
  946.         endpara                         * Go to end of Index
  947.         find "(" paste ")"              *
  948.         return "I" return               * Find first marked word in doc
  949.     jfalse NOMARK:                      *
  950.         begline                         * If mark found go to begline
  951.         maketopofscreen scrollup        * Cursor on line 2                |a
  952.     jump END:                           *
  953.     NOMARK:                             *
  954.         begfile                         * If no mark found go to begfile
  955.     END:
  956. *
  957. * 34 bytes Sun  07-28-1991  15:48:33 (TH @1)
  958. * 52 bytes Wed  07-31-1991  14:43:31 (TH @h, @4 in BOOKxx.QM)
  959.  
  960.  
  961. * =========================================================================
  962. * Date: 10-29-90 (13:26)           Number: 3156         SemWare Support BBS
  963. *   To: EDGAR ESTRADA              Refer#: 3155
  964. * From: TIM FARLEY                   Read: YES
  965. * Subj: Qedit                        Conf: (21) ILink
  966. * ------------------------------------------------------------------------
  967. * EE>I'm interested in finding out how to get Qedit to wordwrap while using
  968. * EE>the right cursor key.
  969. *
  970. * You mean like WordStar does, where it won't let the cursor move
  971. * out into the "empty space" to the right of the lines?
  972. *
  973. * Here are some macros to do this in 2.1:
  974. *
  975. * *
  976. * * Left and Right cursor definitions that wrap to previous/next
  977. * *                line like WordStar does
  978. * *
  979. *-------------------------------------
  980. * (CursorLeft) Macro   (line added TH)
  981. *-------------------------------------
  982. *
  983. * cursorleft    MacroBegin
  984. *               CursorLeft     * try to go left
  985. *               JTrue end:     * succeed!  then we are done
  986. *               CursorUp       * else try to go to prev line
  987. *               JFalse end:    * if fail, then at top of file. done.
  988. *               EndLine        * jump to end of previous line.
  989. *             end:
  990. *
  991. * 13 bytes Mon  10-29-1990  19:33:07 (line added TH)
  992.  
  993. * 
  994. *-------------------------------------
  995. * (CursorRight) Macro  (line added TH)
  996. *-------------------------------------
  997. *
  998. * cursorright   MacroBegin
  999. *               EndLine        * are we at end of line?
  1000. *               JFalse down:
  1001. *               PrevPosition   * back to where we were
  1002. *               CursorRight    * and right one
  1003. *               Jump end:
  1004. *             down:
  1005. *               CursorDown     * try to go to next line
  1006. *               JFalse end:
  1007. *               BegLine
  1008. *             end:
  1009. *
  1010. * 18 bytes Mon  10-29-1990  19:32:57 (line added TH)
  1011.  
  1012. * NOTE:  You must have the latest registered release of QEdit 2.1
  1013. *        to use these macros.  Otherwise you will experience odd
  1014. *        side-effects in the menus and other special contexts where
  1015. *        the arrow keys have meaning.
  1016. *
  1017. * There will be an easier way to achieve this behavior in the next
  1018. * release of QEdit.
  1019. *
  1020. * --Tim Farley
  1021. *   SemWare Technical Support
  1022.  
  1023. *------------ (Single line macros for QCONFIG.DAT) ----------------
  1024.  
  1025. * cursorleft MacroBegin CursorLeft JTrue Label0: CursorUp JFalse Label1: EndLine Label0: Label1:
  1026.  
  1027. * cursorright MacroBegin EndLine JFalse Label0: PrevPosition CursorRight Jump Label1: Label0: CursorDown JFalse Label2: BegLine Label1: Label2:
  1028.  
  1029. * Here are four macros that are variations of wordleft and wordright.
  1030. * Macros @a and @f position the cursor on the first word delimiter
  1031. * after wordleft and wordright. The cursor position will be the space
  1032. * following the word as long as no other word delimiter like "," and
  1033. * *"." etc immediately follows the word. Macros @a and @f unmark any
  1034. * previously marked block, but I don't know any other way to keep this
  1035. * from happening. Macros ^a and ^f do almost what wordleft and
  1036. * wordright do except the cursor does not stop at the end of a line.
  1037. *
  1038. *          @a Moves cursor to first word delimiter after wordleft
  1039. *          @f Moves cursor to first word delimiter after wordright
  1040. *          ^a Moves cursor to first character of wordleft
  1041. *          ^f Moves cursor to first character of wordright
  1042.  
  1043. * 
  1044. *┌──────────────────────────────────────────────────────────────┐
  1045. *│@(a) Moves cursor to first word delimiter after wordleft      │
  1046. *└──────────────────────────────────────────────────────────────┘
  1047. @a  macrobegin                          *
  1048.     wordleft wordleft                   * Move wordleft twice
  1049.     endline                             * Test if on eol
  1050.  jtrue NO_EOL:                          * If not on eol, tests true
  1051.     wordleft                            * If on eol, goto wordleft
  1052.     jump GOTOPOS:                       * Go to end of word
  1053.  NO_EOL: prevposition                   * If not at eol, return
  1054.  GOTOPOS:                               * to where we were
  1055.     markword gotoblockend unmarkblock   * Get to end of word
  1056. *
  1057. * 18 bytes Mon  10-22-1990  11:32:21
  1058.  
  1059. * 
  1060. *┌─────────────────────────────────────────────────────────────┐
  1061. *│@(f) Moves cursor to first word delimiter after wordright    │
  1062. *└─────────────────────────────────────────────────────────────┘
  1063. @f  macrobegin                          *
  1064.     wordright                           * Move wordright
  1065.     endline                             * Test if on eol
  1066.  jtrue NO_EOL:                          * If not on eol, tests true
  1067.     wordright                           * If on eol, goto wordright
  1068.     jump GOTOPOS:                       * Go to end of word
  1069.  NO_EOL: prevposition                   * If not at eol, return to
  1070.  GOTOPOS:                               * where we were
  1071.     markword gotoblockend unmarkblock   * Get to end of word
  1072. *
  1073. * 17 bytes Mon  10-22-1990  11:32:32
  1074.  
  1075. * 
  1076. *┌─────────────────────────────────────────────────────────────┐
  1077. *│^(a_) Moves cursor to first character of wordleft            │
  1078. *└─────────────────────────────────────────────────────────────┘
  1079. ^a  macrobegin                          *
  1080.     wordleft                            * Move wordleft
  1081.     endline                             * Test if on eol
  1082.  jtrue NO_EOL:                          * If not on eol, tests true
  1083.     wordleft                            * If on eol, goto wordleft
  1084.     jump GOTOPOS:                       * End macro
  1085.  NO_EOL: prevposition                   * If not at eol, return to
  1086.  GOTOPOS:                               * where we were
  1087. *
  1088. * 14 bytes Mon  10-22-1990  11:53:14
  1089.  
  1090. * 
  1091. *┌─────────────────────────────────────────────────────────┐
  1092. *│^(f_) Moves cursor to first character of wordright       │
  1093. *└─────────────────────────────────────────────────────────┘
  1094. ^f macrobegin                           *
  1095.     wordright                           * Move wordright
  1096.     endline                             * Test if on eol
  1097.  jtrue NO_EOL:                          * If not on eol, tests true
  1098.     wordright                           * If on eol, goto wordright
  1099.     jump GOTOPOS:                       * End macro
  1100.  NO_EOL: prevposition                   * If not at eol, return to
  1101.  GOTOPOS:                               * where we were
  1102. *
  1103. * 14 bytes Mon  10-22-1990  11:53:03
  1104.  
  1105.  
  1106. * (F4)
  1107. f4      RepeatFind
  1108.  
  1109. * (F5)
  1110. f5      PrevFile
  1111.  
  1112. * (F6)
  1113. f6      NextFile
  1114.  
  1115. * (VERSION) HISTORY:
  1116. *
  1117. *    1.0a - Corrected @5 to use @SRCH-FG.lst, not SRCH.lst.
  1118. *    1.0b - Modified to not use optional batch file.
  1119. *         - Removed @5.
  1120. *    1.0c - Added Alt_0 for search/replace from command line.
  1121. *         - Modified SRC.BAT, @1 & @4 for case sensitive search.
  1122. *         - Modified @4 to re-load search files after replacement.
  1123. *         - Corrected @1 byte size.
  1124. *    1.0d - Removed redundant lines from @0, shortened 31 bytes
  1125. *         - added START-SR.BAT for quick start.
  1126. *         - Changed c:srch.ql to c:$.qm in macros and batch files.
  1127. *           so as to not overwrite qsrch.ql supplied in SRCHxx.ZIP.
  1128. *         - Added killfile c:$.ql to @1 and @4.
  1129. *         - Changed FC0 to fc0 in macros and batch files for better
  1130. *         - visibility.
  1131. *    1.0e - Added @5 for prompted replacement from command line
  1132. *         - Added @6 for prompted replacement while editing
  1133. *         - Added F4/F6 repeatfind/nextfile
  1134. *         - Modified @4 for single search/replacement text input.
  1135. *    1.0f - Modified SR.BAT and SRC.BAT
  1136. *    1.0g - Modified SR.BAT, SRC.BAT and START-SR.BAT.
  1137. *         - Removed INPUT.COM and INPUT.DOC pending author
  1138. *           permission to include.
  1139. *    1.0h - Removed SRC.BAT, Modified all macros and batch files for
  1140. *           Case insensitive search
  1141. *         - Added @7 and SRL.BAT to only load files with search text,
  1142. *           no replacement
  1143. *         - Modified SR.BAT to load SRCHxx.MAC on start up.
  1144. *    1.0i - Modified @3 to re-load files after replacement.
  1145. *         - Modified all macros and batch files for case insensitive
  1146. *           search, some had not been changed in v1.0h.
  1147. *         - Corrected some macro byte sizes
  1148. *    1.0j - Modified comments in SR.BAT, SRL.BAT
  1149. *         - Modified @7 to about half the size and twice the speed.
  1150. *         - Included a PCED synonym to search/load files with @7.
  1151. *    1.1  - Corrected @7 macro size
  1152. *         - Removed savefile from old @0
  1153. *         - Modified @0 to load FGREP.COM found text, after replacement.
  1154. *         - Added [copy c:$.ql c:!] to SR.BAT
  1155. *         - Changed FGREP.COM "-f0" to "-f" in SR.BAT, loads found text
  1156. *         - Removed @5, same thing can be done with @1/2 and
  1157. *           manual search/replace.
  1158. *         - Modified srch.ql load filelist for quicker file loading.
  1159. *    1.2  - Changed "c:$.ql" to "c:!" in macros @1/4/6, shortened
  1160. *           each macro 12 bytes.
  1161. *    1.3  - Modified @3 to be smaller and faster.
  1162. *    1.4  - Changed "*F" to #42 "Fi" in @0 and @7 to be able to load
  1163. *           this file and SRL.QM with SR and SRL.
  1164. *         - Modified SRL.BAT to accept SRL [search text] from command
  1165. *           as long as [search text] is a SINGLE word.
  1166. *         - Added altwordset to @0 and @7 to correctly load file names
  1167. *           containing the Altwordset characters.
  1168. *         - Changed .lst and .ql files.
  1169. *    1.5  - Removed E:\up from SR.BAT & SRL.BAT
  1170. *    1.6  - Added @8 and @9, modified SR.BAT and SRL.BAT.
  1171. *         - @3 was deleting first character in loaded files,
  1172. *           corrected.
  1173. *    1.7  - Added @h to help locate items or macros from Index.
  1174. *         - Added @5.
  1175. *         - Removed @3, same thing is done better by @8.
  1176. *         - Removed @4 and @6, same thing is done better with @5.
  1177. *         - Modified @0 to use the "Once-Around the ring"
  1178. *           technique developed by Kyle Watkins of SemWare.
  1179. *         - Modified SR.BAT and SRL.BAT.
  1180. *    1.8  - Replaced RepeatFind w/ Find "G" in @9.
  1181. *         - Modified SR.BAT and SRL.BAT.
  1182. *    1.9  - Changed Find initialization in @5 and @0.
  1183. *         - Modified START-SR.BAT for no search/replace text.
  1184. *         - Modified @5, @8, @9 and @0 to be shorter and faster.
  1185. *         - Moved SET >c:$ from @0 macro to SR.BAT batch file.
  1186. *    2.0  - Added @a, @f, ^a, ^f variations of wordleft & wordright.
  1187. *         - Changed quick start file from START-SR to START.
  1188. *    2.1  - Added new key definitions for CursorLeft and CursorRight
  1189. *           to wrap cursor to previous/next line like Wordstar does.
  1190. *         - Changed SEARCH file names to SRCH.
  1191. *    2.1a - Corrected Index Use instructions.
  1192. *    2.2  - Modified @7 (SRL.QM) to highlight first occurrence of
  1193. *           search text.
  1194. *         - Modified SR.BAT and SRL.BAT to search all files in current
  1195. *           directory if SRCH-FG.LST does NOT exist in directory.
  1196. *         - Changed FGREP.COM search target delimiter from " to / in order
  1197. *           to find strings with " (@1, @5, SR.BAT, SRL.BAT).
  1198. *         - Added F5 - PrevFile.
  1199. *         - Added ^f1 & ^f2 to find multiple search text in current file
  1200. *           using FGREP.COM or Dos FIND. Original macros by Tim Farley.
  1201. *    2.3  - Added ^f3 to view another occurrence of search text found
  1202. *           with either ^f1 or ^f2.
  1203. *    2.4  - Added @4 in SRQ.QM to quit each file after replacement
  1204. *           using SRQ.BAT. Quits file after replacement.
  1205. *    2.5  - Removed /LSRCHxx.mac from sr.bat and srl.bat.
  1206. *         - Removed /LSRQ.mac from srq.bat.
  1207. *    2.6  - Added @6 for "fuzzy" & and/or MaxFind searches from command line.
  1208. *         - Added "No found text" message to @0_4_7.
  1209. *         - Added find initialize for search to @0 and @7.
  1210. *         - Added "GIN" automatic replace option to @0 and @4.
  1211. *         - Changed @0 to load FGREP.COM output as first file after replacement.
  1212. *         - Added FGREP.COM "-l" line # option to sr.bat, srl.bat and srq.bat.
  1213. *         - Added /LSRxxxx.mac to sr.bat and srl.bat for F4_6 operation.
  1214. *         - Added /LSRQ.mac to srq.bat for F4_6 operation.
  1215. *         - Changed test.qm name to srch.tst
  1216. *         - Modified SR.BAT, SRL.BAT, SRQ.BAT and SM.BAT.
  1217. *         - Changed SRCH_Q name to SRQ.
  1218. *    2.7  - Changed GOTO 2b to 6a in SR.BAT and SRQ.BAT to stop
  1219. *           batch file when no file list is entered at query prompt.
  1220. *         - Changed FGS to S~~ and FGR to R~~ in @0, 4, 6 and 7.
  1221. *         - Added SZ.BAT and SZR.BAT to search/replace within ZIP files.
  1222. *         - Changed search and replace to scrap routine in @0 and @4.
  1223. *         - Changed initialize find routine in @7.
  1224. *         - Changed all batch file formats.
  1225. *    2.8  - Added discussion of environment variable to this file.
  1226. *         - Added environment variable SRMAC to batch files.
  1227. *         - Modified batch files for user option to set environment
  1228. *           variable FILELIST for different file lists. All batch files
  1229. *           can now be run from any directory.
  1230. *    2.9  - Added environment variable SZTEMP to SZ.BAT and SZR.BAT.
  1231. *         - Removed unnecessary "com" extension from fgrep.com that
  1232. *          "snuck" into  @1, @5, and ^F1.
  1233. *         - Changed "c:$.ql" to "c:\$.ql" in SRL.BAT.
  1234. *    2.9a - Corrected Index. Included in AMAC39.ZIP, July 21, 1991.
  1235. *    2.9b - Changed documentation.
  1236. *         - Added latest version of @h.                                8/2/91
  1237. *
  1238. *
  1239. *
  1240.